package com.isesol.ime.rest.api;

import com.isesol.api.rest.annoations.*;
import com.isesol.api.rest.model.base.*;
import com.isesol.arch.common.model.*;
import com.isesol.ime.dal.model.dto.*;
import com.isesol.ime.rest.model.param.*;
import com.isesol.ime.service.*;
import com.smtcl.iplatform.machinearchive.rentservices.*;
import com.smtcl.iplatform.machinearchive.rentservices.dto.*;
import org.modelmapper.*;
import org.springframework.stereotype.*;
import org.springframework.transaction.annotation.*;

import javax.annotation.*;
import java.util.*;

/**
 * 机床类型管理
 *
 * @author
 */
@Service
@RestServiceClass(url = "user")
public class UserResource extends BusinessResources {

    @Resource
    LoginService loginService;

    @Resource
    protected ModelMapper modelMapper;

    @Transactional
    @RestServiceMethod(url = "login", requestType = MachineToolLoginRequest.class)
    public LoginResult login(MachineToolLoginRequest request) throws Exception {

        LOGGER.info("【UserResource】login, request = {}",request);

        LoginDTO loginDTO = modelMapper.map(request, LoginDTO.class);
        LoginResult result = loginService.login(loginDTO);

        return result;

    }
}
